From 4489afd03166e042ad3ed32c5538b297e8dc18cc Mon Sep 17 00:00:00 2001 From: Eddie Dong Date: Thu, 9 Jun 2011 16:24:09 +0800 Subject: [PATCH] Nested VMX: Lazy FPU for n2 guest Signed-off-by: Qing He Signed-off-by: Eddie Dong Acked-by: Tim Deegan Committed-by: Tim Deegan --- xen/arch/x86/hvm/vmx/vvmx.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 87ceef3f1f..eca653f2a0 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -810,6 +810,9 @@ static void virtual_vmentry(struct cpu_user_regs *regs) regs->esp = __get_vvmcs(vvmcs, GUEST_RSP); regs->eflags = __get_vvmcs(vvmcs, GUEST_RFLAGS); + /* updating host cr0 to sync TS bit */ + __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0); + /* TODO: EPT_POINTER */ } @@ -958,6 +961,9 @@ static void virtual_vmexit(struct cpu_user_regs *regs) regs->esp = __get_vvmcs(nvcpu->nv_vvmcx, HOST_RSP); regs->eflags = __vmread(GUEST_RFLAGS); + /* updating host cr0 to sync TS bit */ + __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0); + vmreturn(regs, VMSUCCEED); } @@ -1306,13 +1312,18 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs, /* * decided by L0 and L1 exception bitmap, if the vetor is set by - * both, L0 has priority on #PF, L1 has priority on others + * both, L0 has priority on #PF and #NM, L1 has priority on others */ if ( vector == TRAP_page_fault ) { if ( paging_mode_hap(v->domain) ) nvcpu->nv_vmexit_pending = 1; } + else if ( vector == TRAP_no_device ) + { + if ( v->fpu_dirtied ) + nvcpu->nv_vmexit_pending = 1; + } else if ( (intr_info & valid_mask) == valid_mask ) { exec_bitmap =__get_vvmcs(nvcpu->nv_vvmcx, EXCEPTION_BITMAP); -- 2.30.2